package com.dragon.datastructure.tree.binarysearchtree;

/**
 * 二分搜索树的测试
 *
 * @author dragon
 * @since 2019/12/30
 */
public class BinarySearchTreeTest {

    public static void main(String[] args) {
        BinarySearchTree<Integer> bst = new BinarySearchTree<>();
        for (int i = 0; i < 2; i++) {
            bst.add((int) (Math.random() * 120));
        }
        System.out.println(bst.size());
        bst.midOrder();
        System.out.println();
        System.out.println(bst.contains(100));
        System.out.println(bst.contains(99));

        bst.levelOrder();
        System.out.println();

        bst.preOrderNC();

        System.out.println();

        System.out.println(bst.minimum());

        System.out.println(bst.maximum());


//        System.out.println(bst.removeMax());

        System.out.println("最大值:" + bst.maximum());

//        System.out.println(bst.removeMin());

        System.out.println("最小值:" + bst.minimum());

        bst.midOrder();
        System.out.println();

        bst.remove(100);

        bst.levelOrder();

        bst.remove(110);


        System.out.println();

        bst.midOrder();

    }
}
